//
//  BaseADController.h
//  HybidMediation
//
//  Created by jay Win on 2019/9/17.
//  Copyright © 2019 jay Win. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "KKAnalytics.h"

NS_ASSUME_NONNULL_BEGIN

@class KKAdController;
@protocol KKAdsDelegate <NSObject>

-(void)onShowGdpr;
-(void)onShowCOPPA;



-(void)onSplashRequest;
-(void)onSplashLoaded;
-(void)onSplashLoadedFailed:(NSString *)error;
-(void)onSplashImpression;

-(void)onBannerRequest;
-(void)onBannerLoaded;
-(void)onBannerImpression;
-(void)onBanenrLoadedFailed:(NSString *)error;
-(void)onBannerClick;

-(void)onInterstitialRequest;
-(void)onInterstitialLoaded;
-(void)onInterstitialLoadedFailed:(NSString*)error;
-(void)onInterstitialTrigger;
-(void)onInterstitialPlayFailed:(NSString *)error;
-(void)onInterstitialOpen;
-(void)onInterstitialClick;
-(void)onInterstitialClose;

-(void)onRewardVideoRequest;
-(void)onRewardVideoLoaded;
-(void)onRewardVideoLoadedFailed:(NSString *)error;
-(void)onRewardVideoTrigger;
-(void)onRewardVideoPlayFailed:(NSString *)error;
-(void)onRewardVideoClick;
-(void)onRewardVideoOpen;
-(void)onRewardVideoClose;
-(void)onRewardVideoComplete;
@end

@interface BaseADController : NSObject

@property (nonatomic, strong) id<KKAdsDelegate>delegate;

@property(nonatomic,copy)NSString *(^onSplashImpression)(void);
@property(nonatomic,copy)NSString *(^onSplashFailed)(void);


@property(nonatomic,copy)void(^onBannerImpression)(void);
@property(nonatomic,copy)void(^onBannerLoadFailed)(void);

@property(nonatomic,copy)void(^onVideoOpen)(void);
@property(nonatomic,copy)void(^onVideoClose)(void);
@property(nonatomic,copy)void(^onVideoComplete)(void);



@property NSString *idfa;
@property BOOL debug;
@property BOOL completeRewardVideo;
@property BOOL isRequestingInterstitial;
@property BOOL isRequestingRewardVideo;




@property BOOL isBannerTop;
@property BOOL needFixBannerSize;








@property NSString *banner_id;
@property NSString *interstitial_id;
@property NSString *reward_id;

@property double initAdsTime;

@property (nonatomic,strong)UIView *bannerContainer;
@property(nonatomic,strong)UIViewController  *rootViewController;


-(void)initAds:(void(^)(void))succeed;
-(void)loadPlacementID;
-(void)loadRequestConfig;
-(void)agreeGDPR;
-(void)agreeCOPPA;
-(void)showlog:(NSObject *)obj;




-(void)loadSplash:(UIViewController *)rootViewController customView:(UIView*__nullable)logoView;
-(void)loadSplash:(UIViewController *)rootViewController customView:(UIView*__nullable)logoView onImpressionEvent:(NSString *(^)(void))onImpression onFailedEvent:(NSString *(^)(void))onFailed;


-(void)showBanner:(UIViewController *)rootViewController bannerContainner:(UIView * )containner isTop:(BOOL)position;

-(void)showBanner:(UIViewController *)rootViewController
bannerUIContainer:(UIView *)container
onImpressionEvent:(void(^)(void))onImpression;







-(void)hideBanner;
-(void)requestInterstitial;
-(BOOL)hasInterstitial;
-(void)showInterstitial:(UIViewController *)rootViewController;
-(void)showInterstitial:(UIViewController *)rootViewController
            onOpenEvent:(void(^)(void))onOpen
           onCloseEvent:(void(^)(void))onClose;

-(void)requestRewardVideo;
-(BOOL)hasRewardVideo;
-(void)showRewardVideo:(UIViewController *)rootViewController;
-(void)showRewardVideo:(UIViewController *)rootViewController
           onOpenEvent:(void(^)(void))onOpen
          onCloseEvent:(void(^)(void))onClose
       onCompleteEvent:(void(^)(void))onComplete;



-(void)upLoadedMopubAdsImpressionDataToAdjsut:(NSDictionary *)dic;
@end

NS_ASSUME_NONNULL_END
